package com.train.system.api;

import com.train.common.resp.CommonResp;
import com.train.system.resp.trainstation.TrainStationListResp;
import com.train.system.resp.trainstation.TrainStationResp;
import com.train.system.service.TrainStationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class TrainStationApiImpl implements TrainStationApi {

    @Autowired
    private TrainStationService trainStationService;

    @Override
    public CommonResp getTrainStationByCode(List<String> trainCodes) {
        List<TrainStationResp> resp = trainStationService.getTrainStationByCode(trainCodes);
        return CommonResp.ok(resp);
    }

    @Override
    public CommonResp getTrainStationListByTrainCodes(List<String> trainCodes) {
        List<TrainStationListResp> trainStationListResps = trainStationService.getTrainStationListByTrainCodes(trainCodes);
        return CommonResp.ok(trainStationListResps);
    }
}
